package problems;

import java.util.List;

import lib.MathLib;

public class Euler021 extends AbstractEuler {

	@Override
	public Number calculate() {
		Long result = 0L;
		for (long i = 1; i < 10000; i++) {
			List<Long> divisors = MathLib.getProperDivisors(i);
			long divisorSum = MathLib.getSum(divisors);
			if (divisorSum != i && MathLib.getSum(MathLib.getProperDivisors(divisorSum)) == i) {
				result += i; 
			}
		}
		return result;
	}

	@Override
	protected Number getCorrectAnswer() {
		return 31626L;
	}

}
